package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.PreparedStatement;
import com.asiainfo.ysrman.util.DBmanage;

public final class ImportData_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GB18030");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n");
      out.write("<html>\r\n");
      out.write("    <head>\r\n");
      out.write("    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=GB18030\">\r\n");
      out.write("    <link href=\"styles/styles.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("    <META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\r\n");
      out.write("    <META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">\r\n");
      out.write("    <META HTTP-EQUIV=\"Expires\" CONTENT=\"0\">\r\n");
      out.write("    <script src=\"script/calendar.js\"></script>\r\n");
      out.write("    <style type=\"text/css\">\r\n");
      out.write("            <!--\r\n");
      out.write("            body {\r\n");
      out.write("            background-color:#ffffff;\r\n");
      out.write("            }\r\n");
      out.write(".style1 {color: #FFFFFF}\r\n");
      out.write("            -->\r\n");
      out.write("        </style>\r\n");
      out.write("    <script language=\"javascript\">\r\n");
      out.write("\r\n");
      out.write("            //获取一级菜单长度\r\n");
      out.write("            //var select1_len = document.frm.s1.options.length;\r\n");
      out.write("            //var select2 = new Array(select1_len);\r\n");
      out.write("            var select2 = new Array();\r\n");
      out.write("            //alert(select1_len);\r\n");
      out.write("            //把一级菜单都设为数组\r\n");
      out.write("            for (i=0; i<333; i++) \r\n");
      out.write("            {\r\n");
      out.write("            select2[i] = new Array();\r\n");
      out.write("            }\r\n");
      out.write("\r\n");
      out.write("            //定义基本选项\r\n");
      out.write("            //select2[0][0] = new Option(\"请选择\", \"0\");\r\n");
      out.write("            ");

                Connection conn = null;
                conn = DBmanage.getInstance().getConnection();
                PreparedStatement ps = null;
                ResultSet rs = null;
                PreparedStatement ps1 = null;
                ResultSet rs1 = null;
                PreparedStatement ps2 = null;
                ResultSet rs2 = null;
                PreparedStatement ps3 = null;
                ResultSet rs3 = null;
                PreparedStatement ps4 = null;
                ResultSet rs4 = null;

                ps = conn.prepareStatement("select * from yl_area order by areaid");

                rs = ps.executeQuery();
                int i=0;
                String AreaID="";
                String areaID="";
                while(rs.next()){
                    AreaID=rs.getString("areaid").substring(0,3);
                    int areaid=Integer.parseInt(AreaID);
                    if(!AreaID.equals(areaID)){
                        i=0;
                    }
                    if(areaid==162){
                        out.print("select2[161][23] = new Option(\""+rs.getString("areaname")+"\",\""+rs.getString("areaid")+"\");\n");
                    }else{
                        out.print("select2["+areaid+"]["+i+"] = new Option(\""+rs.getString("areaname")+"\",\""+rs.getString("areaid")+"\");\n");
                    }
                    areaID=rs.getString("areaid").substring(0,3);
                    i++;
                }
            
      out.write("\r\n");
      out.write("\r\n");
      out.write("            //联动函数\r\n");
      out.write("            function redirec(x){\r\n");
      out.write("            var temp = document.frm.s2; \r\n");
      out.write("            for(i=frm.s2.options.length-1;i>=0;i--){\r\n");
      out.write("\r\n");
      out.write("            frm.s2.options[i]=null;\r\n");
      out.write("            }\r\n");
      out.write("            for (i=0;i<select2[x].length;i++){\r\n");
      out.write("            temp.options[i]=new Option(select2[x][i].text,select2[x][i].value);\r\n");
      out.write("            }\r\n");
      out.write("            temp.options[0].selected=true;\r\n");
      out.write("            }\r\n");
      out.write("\r\n");
      out.write("        </script>\r\n");
      out.write("    <script language=\"JavaScript\">\r\n");
      out.write("\r\n");
      out.write("            function fnAddType(){\r\n");
      out.write("            var ints2ID;\r\n");
      out.write("            var strs2Name;\r\n");
      out.write("            for(i=0;i<frm.s2.options.length;i++)\r\n");
      out.write("            {\r\n");
      out.write("            if(frm.s2.options[i].selected)\r\n");
      out.write("            {\r\n");
      out.write("            ints2ID=frm.s2.options[i].value;\r\n");
      out.write("            strs2Name=frm.s2.options[i].innerHTML;\r\n");
      out.write("            fnDoAdds2(ints2ID,strs2Name);\r\n");
      out.write("            }\r\n");
      out.write("            }\r\n");
      out.write("            }\r\n");
      out.write("\r\n");
      out.write("            function fnDoAdds2(ints2ID,strs2Name)\r\n");
      out.write("            {\r\n");
      out.write("            var i;\r\n");
      out.write("            for(i=0;i<frm.object_select.options.length;i++)\r\n");
      out.write("            {\r\n");
      out.write("            if(frm.object_select.options(i).value==ints2ID)\r\n");
      out.write("            {\r\n");
      out.write("            alert(\"您已经选择过了\");\r\n");
      out.write("            return;\r\n");
      out.write("            }\r\n");
      out.write("            }\r\n");
      out.write("            var oOption = document.createElement(\"OPTION\");\r\n");
      out.write("            frm.object_select.options.add(oOption);\r\n");
      out.write("            oOption.text = strs2Name;\r\n");
      out.write("            oOption.value = ints2ID;\r\n");
      out.write("            }\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("            function fnobject_list()\r\n");
      out.write("            {\r\n");
      out.write("            var i;\r\n");
      out.write("            if(frm.object_select.selectedIndex < 0)\r\n");
      out.write("            {\r\n");
      out.write("            alert(\"请选择一个类型\");\r\n");
      out.write("            frm.object_select.focus();\r\n");
      out.write("            return;\r\n");
      out.write("            }\r\n");
      out.write("\r\n");
      out.write("            for(i=frm.object_select.options.length-1;i>=0;i--)\r\n");
      out.write("            {\r\n");
      out.write("            if(frm.object_select.options[i].selected)\r\n");
      out.write("            frm.object_select.options[i]=null;\r\n");
      out.write("            }\r\n");
      out.write("            }\r\n");
      out.write("            function fnSubmit(){\r\n");
      out.write("\t\t\tLayer1.style.visibility=\"visible\";\r\n");
      out.write("            if(frm.num.value==\"\"){\r\n");
      out.write("            \talert(\"请选择导入数据数量\");\r\n");
      out.write("            \tfrm.num.focus();\r\n");
      out.write("            \treturn false;\r\n");
      out.write("            }\r\n");
      out.write("            if(frm.s1.options.value!=0 && frm.object_select.options.length==0){\r\n");
      out.write("            \talert(\"地区选择“全部”，抽奖地区才能为空\");\r\n");
      out.write("            \tfrm.s1.focus();\r\n");
      out.write("            \treturn false;\r\n");
      out.write("            }\r\n");
      out.write("            frm.obj.value=\"\";\r\n");
      out.write("            for(i=0;i<frm.object_select.options.length;i++)\r\n");
      out.write("            {\r\n");
      out.write("            frm.obj.value +=frm.object_select.options[i].value + \";\"\r\n");
      out.write("            }\r\n");
      out.write("            frm.action=\"ImportData.jsp\";\r\n");
      out.write("            return true;\r\n");
      out.write("            }\r\n");
      out.write("        </script>\r\n");
      out.write("    <SCRIPT>\r\n");
      out.write("            function IsDigit()\r\n");
      out.write("            {\r\n");
      out.write("            return ((event.keyCode >= 48) && (event.keyCode <= 57));\r\n");
      out.write("            }\r\n");
      out.write("        </SCRIPT>\r\n");
      out.write("    <title>导入数据</title>\r\n");
      out.write("    <script language=\"JavaScript\" type=\"text/JavaScript\">\r\n");
      out.write("<!--\r\n");
      out.write("function MM_reloadPage(init) {  //reloads the window if Nav4 resized\r\n");
      out.write("  if (init==true) with (navigator) {if ((appName==\"Netscape\")&&(parseInt(appVersion)==4)) {\r\n");
      out.write("    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}\r\n");
      out.write("  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();\r\n");
      out.write("}\r\n");
      out.write("MM_reloadPage(true);\r\n");
      out.write("//-->\r\n");
      out.write("    </script>\r\n");
      out.write("    </head>\r\n");
      out.write("    <body>\r\n");
      out.write("        <div id=\"Layer1\" style=\" visibility:hidden;position:absolute; left:297px; top:200px; width:407px; height:68px; z-index:1\" align=\"center\" >\r\n");
      out.write("          <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#004080\">\r\n");
      out.write("            <tr>\r\n");
      out.write("              <td height=\"50\" align=\"center\" valign=\"middle\"><span class=\"style1\">查询中，请稍等...</span></td>\r\n");
      out.write("            </tr>\r\n");
      out.write("          </table>\r\n");
      out.write("        </div>\r\n");
      out.write("        <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("            <tr>\r\n");
      out.write("                <td width=\"60\" height=\"50\" align=\"right\" valign=\"middle\"><img src=\"images/menu_01.jpg\" width=\"60\" height=\"50\"></td>\r\n");
      out.write("                <td height=\"50\" align=\"left\" valign=\"middle\" background=\"images/menu_04.jpg\" class=\"huanying\">抽奖用户数据导入</td>\r\n");
      out.write("                <td width=\"74\" height=\"50\" align=\"left\" valign=\"top\"><img src=\"images/menu_02.jpg\" width=\"74\" height=\"50\"></td>\r\n");
      out.write("            </tr>\r\n");
      out.write("        </table>\r\n");
      out.write("        <form name=\"frm\" method=\"post\"  onSubmit=\"return fnSubmit()\">\r\n");
      out.write("            <!--<input type=\"text\" name=\"textfield\" onfocus=\"if(CalendarWebControl.calendarPad.style.display!='none'){CalendarWebControl.calendarPad.style.display='none';return false;}CalendarWebControl.show(this,false,this.value);return false;\">-->\r\n");
      out.write("            <table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("                <tr>\r\n");
      out.write("                    <td width=\"14\"><img src=\"images/pic-left.jpg\" width=\"14\" height=\"156\"></td>\r\n");
      out.write("                    <td align=\"center\" background=\"images/pic-bg.jpg\"><table width=\"98%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("                        <tr>\r\n");
      out.write("                            <td colspan=\"4\">&nbsp;</td>\r\n");
      out.write("                        </tr>\r\n");
      out.write("                        <tr>\r\n");
      out.write("                            <td>地区选择：\r\n");
      out.write("                            <input name=\"state\" type=\"hidden\" id=\"state\" value=\"1\">\r\n");
      out.write("                            <input name=\"restart\" type=\"hidden\" id=\"restart\" value=\"1\">\r\n");
      out.write("                            <input type=\"hidden\" name=\"obj\" value=\"\"></td>\r\n");
      out.write("                            <td><select name=\"s1\" id=\"s1\" onChange=\"redirec(frm.s1.options.value)\">\r\n");
      out.write("                                <option value=\"0\" selected>全部</option>\r\n");
      out.write("                                <option value=\"11\" >北京市</option>\r\n");
      out.write("                                <option value=\"21\" >上海市</option>\r\n");
      out.write("                                <option value=\"31\" >天津市</option>\r\n");
      out.write("                                <option value=\"41\" >重庆市</option>\r\n");
      out.write("                                <option value=\"61\" >陕西省</option>\r\n");
      out.write("                                <option value=\"71\" >海南省</option>\r\n");
      out.write("                                <option value=\"81\" >黑龙江</option>\r\n");
      out.write("                                <option value=\"91\" >辽宁省</option>\r\n");
      out.write("                                <option value=\"101\" >吉林省</option>\r\n");
      out.write("                                <option value=\"111\" >江苏省</option>\r\n");
      out.write("                                <option value=\"121\" >山东省</option>\r\n");
      out.write("                                <option value=\"131\" >湖南省</option>\r\n");
      out.write("                                <option value=\"141\" >河南省</option>\r\n");
      out.write("                                <option value=\"151\" >福建省</option>\r\n");
      out.write("                                <option value=\"161\" >广东省</option>\r\n");
      out.write("                                <option value=\"171\" >江西省</option>\r\n");
      out.write("                                <option value=\"181\" >浙江省</option>\r\n");
      out.write("                                <option value=\"191\" >山西省</option>\r\n");
      out.write("                                <option value=\"201\" >广西省</option>\r\n");
      out.write("                                <option value=\"211\" >河北省</option>\r\n");
      out.write("                                <option value=\"221\" >湖北省</option>\r\n");
      out.write("                                <option value=\"231\" >云南省</option>\r\n");
      out.write("                                <option value=\"241\" >安徽省</option>\r\n");
      out.write("                                <option value=\"251\" >内蒙古</option>\r\n");
      out.write("                                <option value=\"261\" >甘肃省</option>\r\n");
      out.write("                                <option value=\"271\" >宁夏省</option>\r\n");
      out.write("                                <option value=\"281\" >贵州省</option>\r\n");
      out.write("                                <option value=\"291\" >四川省</option>\r\n");
      out.write("                                <option value=\"301\" >新疆省</option>\r\n");
      out.write("                                <option value=\"311\" >青海省</option>\r\n");
      out.write("                                <option value=\"321\" >西藏省</option>\r\n");
      out.write("                            </select></td>\r\n");
      out.write("                            <td rowspan=\"4\"><select name=\"s2\" size=\"6\" multiple id=\"s2\">\r\n");
      out.write("                            </select><input type=\"button\" name=\"Submit\" value=\"&gt;&gt;\" onclick=fnAddType()>\r\n");
      out.write("                            <input type=\"button\" name=\"Submit\" value=\"&lt;&lt;\" onclick=fnobject_list()></td>\r\n");
      out.write("                            <td rowspan=\"4\"><select name=\"object_select\" size=\"6\" multiple id=\"object_select\">\r\n");
      out.write("                            </select></td>\r\n");
      out.write("                        </tr>\r\n");
      out.write("                        <tr>\r\n");
      out.write("                            <td>奖项选择：</td>\r\n");
      out.write("                            <td>          <select name=\"awardType\" id=\"awardType\">\r\n");
      out.write("                                <option value=\"0\" selected>全部</option>\r\n");
      out.write("                                <option value=\"1\">至尊奖</option>\r\n");
      out.write("                                <option value=\"2\">叱诧奖</option>\r\n");
      out.write("                                <option value=\"3\">人气奖</option>\r\n");
      out.write("                                <option value=\"4\">炫彩奖</option>\r\n");
      out.write("                            </select></td>\r\n");
      out.write("                        </tr>\r\n");
      out.write("                        <tr>\r\n");
      out.write("                            <td>产品类别：</td>\r\n");
      out.write("                            <td><select name=\"proType\" id=\"proType\">\r\n");
      out.write("                                <option value=\"0\" selected>全部</option>\r\n");
      out.write("                                <option value=\"1\">瓶</option>\r\n");
      out.write("                                <option value=\"2\">砖</option>\r\n");
      out.write("                                <option value=\"3\">六连包</option>\r\n");
      out.write("                            </select></td>\r\n");
      out.write("                        </tr>\r\n");
      out.write("                        <tr>\r\n");
      out.write("                            <td>数量选择：</td>\r\n");
      out.write("                            <td><input type=\"text\" name=\"num\" ONKEYPRESS=\"event.returnValue=IsDigit();\"></td>\r\n");
      out.write("                        </tr>\r\n");
      out.write("                        <tr align=\"center\">\r\n");
      out.write("                            <td colspan=\"4\">          <input name=\"imageField\" type=\"image\" src=\"images/zhucetijiao.jpg\" width=\"67\" height=\"24\" border=\"0\" onClick=\"return fnSubmit()\"></td>\r\n");
      out.write("                        </tr>\r\n");
      out.write("                    </table></td>\r\n");
      out.write("                    <td width=\"18\"><img src=\"images/pic-right.jpg\" width=\"18\" height=\"156\"></td>\r\n");
      out.write("                </tr>\r\n");
      out.write("            </table>\r\n");
      out.write("        </form>\r\n");
      out.write("        ");

        
            int state=0;
            int restart=0;
            String s1="";
            String city="";
            int awardType=0;
            int proType=0;
            int num=0;
            String sql="select ID,MOBILE,AREAID,AREANAME,AWARDTYPE,PRO_TYPE,0,SYSDATE from (SELECT id,mobile,areaid,areaname,code,regdate,pro_type,awardtype,ROW_NUMBER() OVER(PARTITION BY mobile,areaid,areaname ORDER BY awardtype) AS RNUM FROM yl_molog WHERE  mobile not in (select mobile from YL_AWARDREC)) AA where AA.RNUM=1 ";
            //and AA.pro_type=2 and AA.awardtype=2 and (AA.areaid='01100' or AA.areaid='02101') and rownum<100
try{
            try{
                state=Integer.parseInt(request.getParameter("state"));
            }catch(Exception e){
                state=0;
                System.out.println("state err");
            }
            try{
                restart=Integer.parseInt(request.getParameter("restart"));
            }catch(Exception e){
                restart=0;
                System.out.println("restart err");
            }
            if(state==1){
                if(restart==1){
                    ps2 = conn.prepareStatement("delete yl_awardtmp");
                    rs2 = ps2.executeQuery();
                    try{
                        s1=request.getParameter("s1");
                    }catch(Exception e){
                        s1="0";
                        System.out.println("s1 err");
                    }
                    awardType=Integer.parseInt(request.getParameter("awardType"));
                    if(awardType!=0){
                        sql=sql+" and AA.awardtype="+awardType;
                    }
                    proType=Integer.parseInt(request.getParameter("proType"));
                    if(proType!=0){
                        sql=sql+" and AA.pro_type="+proType;
                    }
                    try{
                        city=request.getParameter("obj");
                    }catch(Exception e){
                        city="";
                        System.out.println("city err");
                    }
                    String[] cityid=city.split(";");
                    if(!s1.equals("0")){
                        sql=sql+" and (AA.areaid='000000' ";
                        for(int ii=0;ii<cityid.length;ii++){
                            //out.print(cityid[ii].substring(3));
                            //out.print("<br>");
                            if(cityid[ii].substring(3).equals("00")){
                                sql=sql+" or substr(AA.areaid,0,3)='"+cityid[ii].substring(0,3)+"'";
                            }else{
                                sql=sql+" or AA.areaid='"+cityid[ii]+"'";
                            }
                        }
                        sql=sql+" ) ";
                    }
                    num=Integer.parseInt(request.getParameter("num"));
                    sql=sql+" and rownum<"+(num+1);
                    //out.print(sql);
                    sql="insert into yl_awardtmp "+sql;

                        ps3 = conn.prepareStatement(sql);
                        rs3 = ps3.executeQuery();
                }
                //out.print(cityid.length);
                //如果是页面提交
                //这里进行数据处理
                //1.每次处理前，将临时数据表清空
                //2.拼接SQL
                //3.写数据库
                //4.读数据库
                int nPage=20;//每页显示数量
                int p=0;//当前页数
                int PageCount=0;//总纪录数
                int pageNum=0;//页数
                try{
                    p=Integer.parseInt(request.getParameter("p"));
                }catch(Exception e){
                    p=0;
                }
                int iStart=p*nPage;
                int iEnd=(p+1)*nPage;
                
                ps2 = conn.prepareStatement("select count(*) rownums from yl_awardtmp");
                rs2 = ps2.executeQuery();
                if(rs2.next()){
                	PageCount=rs2.getInt("rownums");
                }
                
                //out.print("select * from (select yl_awardtmp.*,rownum num from yl_awardtmp where rownum<="+iEnd+") where num>"+iStart);
                ps4 = conn.prepareStatement("select * from (select yl_awardtmp.*,rownum num from yl_awardtmp where rownum<="+iEnd+") where num>"+iStart);
                rs4 = ps4.executeQuery();
        
      out.write("\r\n");
      out.write("        <form name=\"frm1\" method=\"post\" action=\"DelImportData.jsp\">\r\n");
      out.write("            <table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
      out.write("                <tr>\r\n");
      out.write("                    <td height=\"35\" colspan=\"6\" class=\"suoyin\">\r\n");
      out.write("\t\t\t\t\t<input name=\"state\" type=\"hidden\" id=\"state\" value=\"1\">\r\n");
      out.write("                            <input name=\"restart\" type=\"hidden\" id=\"restart\" value=\"0\">\r\n");
      out.write("\t\t\t\t\t\t\t&nbsp;&nbsp;<span class=\"huanying\">抽奖用户数据库</span></td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr class=\"shujutittle\">\r\n");
      out.write("                    <td>选择</td>\r\n");
      out.write("                    <td>序号</td>\r\n");
      out.write("                    <td>手机号</td>\r\n");
      out.write("                    <td>所属地区</td>\r\n");
      out.write("                    <td>所中奖项</td>\r\n");
      out.write("                    <td>产品类型</td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                ");

                    int iCount=0;
                while(rs4.next()){
                            iCount++;
                
      out.write("\r\n");
      out.write("                <tr ");
if(iCount%2==1){out.print("class=\"erjitable\"");}
      out.write(">\r\n");
      out.write("                    <td>&nbsp;<input name=\"id\" type=\"checkbox\" value=\"");
      out.print(rs4.getString("id"));
      out.write("\"></td>\r\n");
      out.write("                    <td>");
      out.print(rs4.getString("num"));
      out.write("</td>\r\n");
      out.write("                    <td align=\"center\">");
      out.print(rs4.getString("mobile"));
      out.write("</td>\r\n");
      out.write("                    <td align=\"center\">");
      out.print(rs4.getString("areaname"));
      out.write("</td>\r\n");
      out.write("                    <td align=\"center\">\r\n");
      out.write("                        ");

                            switch(rs4.getInt("awardtype")){
                                case 1:
                                    out.print("一等奖(至尊奖)");
                                    break;
                                case 2:
                                    out.print("二等奖(叱诧奖)");
                                    break;
                                case 3:
                                    out.print("三等奖(人气奖)");
                                    break;
                                case 4:
                                    out.print("四等奖(炫彩奖)");
                                    break;
                            }
                        
      out.write("\r\n");
      out.write("                    </td>\r\n");
      out.write("                    <td align=\"center\">\r\n");
      out.write("                        ");

                            switch(rs4.getInt("pro_type")){
                                case 1:
                                    out.print("瓶");
                                    break;
                                case 2:
                                    out.print("砖");
                                    break;
                                case 3:
                                    out.print("六连包");
                                    break;
                            }
                        
      out.write("\r\n");
      out.write("                    </td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                ");

                    }
                
      out.write("\r\n");
      out.write("                <tr>\r\n");
      out.write("                    <td colspan=\"6\" class=\"shujutittle\">共");
      out.print(PageCount);
      out.write("条记录&nbsp;&nbsp;每页显示");
      out.print(nPage);
      out.write("条&nbsp;&nbsp;\r\n");
      out.write("                    ");

                        
                        if(PageCount%nPage==0){
                            pageNum=PageCount/nPage;
                        }else{
                            pageNum=PageCount/nPage+1;
                        }
                        out.print("分"+pageNum+"页显示");
                    
      out.write("&nbsp;&nbsp;<a href=\"ImportData.jsp?state=1&restart=0&p=0\">首页</a>\r\n");
      out.write("                    &nbsp;&nbsp;第&nbsp;\r\n");
      out.write("                    ");

                    	int pStart=0;
                    	int pEnd=0;
                    	if(p<=5){
                    		pStart=0;
                    	}
                    	if(p>5){
                    		pStart=p-5;
                    	}
                    	if(p<=(pageNum-5)){
                    		pEnd=p+5;
                    	}
                    	if(p>(pageNum-5)){
                    		pEnd=pageNum;
                    	}
                        for(int n=pStart;n<pEnd;n++){
                            out.print("<a href=\"ImportData.jsp?state=1&restart=0&p="+n+"\">");
                            if(n==p){
                                out.print("<font color=\"#ff0000\">");
                            }else{
                                out.print("<font color=\"#999999\">");
                            }
                            out.print(n+1);
                            out.print("</font></a>");
                            out.print("&nbsp;");
                        }
                    
      out.write("&nbsp;页&nbsp;&nbsp;<a href=\"ImportData.jsp?state=1&restart=0&p=");
      out.print((pageNum-1));
      out.write("\">末页</a></td>\r\n");
      out.write("                </tr>\r\n");
      out.write("                <tr align=\"center\" bgcolor=\"#CCCCCC\">\r\n");
      out.write("                    <td height=\"35\">&nbsp;</td>\r\n");
      out.write("                    <td height=\"35\">&nbsp;</td>\r\n");
      out.write("                    <td height=\"35\"><a href=\"RandomAward.jsp\"><span class=\"input-loginButton\"> OK提交 </span></a></td>\r\n");
      out.write("                    <td height=\"35\"><a href=\"ImportData.jsp\"><span class=\"input-loginButton\"> 全部清空 </span></a></td>\r\n");
      out.write("                    <td height=\"35\"><input name=\"Submit\" type=\"submit\" class=\"input-loginButton\" value=\"删除\"></td>\r\n");
      out.write("                    <td height=\"35\">&nbsp;</td>\r\n");
      out.write("                </tr>\r\n");
      out.write("            </table>\r\n");
      out.write("        </form>\r\n");
      out.write("        ");

            }
        }catch(Exception e){
            System.out.println(sql+"all err");
            e.printStackTrace();
        }finally {
            if (rs != null) {
                try {
                    rs.close();
                    rs = null;
                } catch (Exception e) {}
            }
            if (ps != null) {
                try {
                    ps.close();
                    ps = null;
                }catch (Exception e) {}
            }
            if (rs1 != null) {
                try {
                    rs1.close();
                    rs1 = null;
                } catch (Exception e) {}
            }
            if (ps1 != null) {
                try {
                    ps1.close();
                    ps1 = null;
                }catch (Exception e) {}
            }
            if (rs != null) {
                try {
                    rs.close();
                    rs = null;
                } catch (Exception e) {}
            }
            if (ps != null) {
                try {
                    ps.close();
                    ps = null;
                }catch (Exception e) {}
            }
            if (rs != null) {
                try {
                    rs.close();
                    rs = null;
                } catch (Exception e) {}
            }
            if (ps != null) {
                try {
                    ps.close();
                    ps = null;
                }catch (Exception e) {}
            }
            if (rs != null) {
                try {
                    rs.close();
                    rs = null;
                } catch (Exception e) {}
            }
            if (ps != null) {
                try {
                    ps.close();
                    ps = null;
                }catch (Exception e) {}
            }
            if (conn != null) {
                try {
                    DBmanage.getInstance().close(conn);
                }catch (Exception e) {}
            }
        }
        
      out.write("\r\n");
      out.write("    </body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
